home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / greendevil_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  2.3 KB  |  79 lines

  1.  
  2. function units_greendevil_setup()
  3.     local unit = uniGetExecutor()
  4.     unit:setVisibility(false,false)
  5.     local pos = D3DXVECTOR3:new(0,0,0)
  6.     pos = unit:getWorldPosition()
  7.     for i = 0,rand(18,24) do
  8.         createWorldEffect(ENET_EFFECT_METEORFALL,pos.x + rand(-80,80),pos.z + rand(-80,80))
  9.         pause(0.2 + rand(0,0.3))
  10.     end
  11.     pos:delete()
  12.     local gdv = getGreenDevilVictims();
  13.     local index = 0;
  14.     local vUID = getArrayElement(gdv,index)
  15.     while(vUID ~= 0) do
  16.         local victim = getTransformByUID(vUID)
  17.         if(victim ~= nil) then
  18.             uniSetLife(3.0 / victim:getMaxHP())
  19.             victim:executeCommand(ENC_DAMAGED)
  20.         end
  21.         index = index + 1
  22.         vUID = getArrayElement(gdv,index)
  23.     end
  24.     unit:destroy()
  25. end
  26.  
  27. function units_greendevil_resetup()
  28. end
  29.  
  30. registerCommand(ENSCRIPTSET_GREENDEVIL,ENC_SETUP,"units_greendevil_setup")
  31. registerCommand(ENSCRIPTSET_GREENDEVIL,ENC_RESETUP,"units_greendevil_resetup")
  32.  
  33. -- make description of unit
  34. desc = getEffectDescriptionP(ENET_UNIT_GREENDEVIL)
  35. desc.ClassID = ENCLASS_MESHINSTANCE
  36. desc.EffectClassType = ENECT_GEOMETRY
  37. desc.FileName = "smallrobot.rmd"
  38. desc.ScriptSet = ENSCRIPTSET_GREENDEVIL
  39. desc.MoveType = ENMOVE_GROUNDORIENTED
  40. desc.RenderType = ENRENDERTYPE_GEOMETRY
  41. desc.Material = ENMAT_RIGIDSKINNEDMESH
  42. desc.MaterialColors = units_materialcolors_human
  43.  
  44. -- shadow
  45. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_SMALLROBOTSHADOW)
  46. desc.ClassID = ENCLASS_MESHINSTANCE
  47. desc.EffectClassType = ENECT_GEOMETRY
  48. desc.FileName = "smallrobot_shadow.rmd"
  49. desc.RenderType = ENRENDERTYPE_SHADOW
  50. desc.Material = ENMAT_SHADOW
  51. desc.MaterialColors = units_materialcolors_shadow
  52.  
  53. -- register new unit to logic
  54. unitDesc = logic_getUnitDescP(52)
  55. unitDesc.group = 0
  56. unitDesc.order = 0
  57. unitDesc.unit_res_id = ENET_UNIT_GREENDEVIL
  58. unitDesc.unit_icon_id = "Smallrobot_h_small_normal.dds"
  59. unitDesc.active_id = "Smallrobot_h_small_active.dds"
  60. unitDesc.pressed_id = "Smallrobot_h_small_pressed.dds"
  61. unitDesc.big_icon_id = "Smallrobot_h_big_normal.dds"
  62. unitDesc.small_icon_id = "Smallrobot_u_stats.dds"
  63. unitDesc.HP = 4
  64. unitDesc.MP = 10
  65. unitDesc.WR = 1
  66. unitDesc.min_WR = 1
  67. unitDesc.WD = 3
  68. unitDesc.WR2 = 0
  69. unitDesc.min_WR2 = 0
  70. unitDesc.WD2 = 0
  71. unitDesc.ability = 0
  72. unitDesc.transport = 0
  73. unitDesc.value = 1
  74. unitDesc.race = 0
  75. unitDesc.fire_pause = 0.2
  76. unitDesc.move_pause = 0.5
  77. unitDesc.unit_info_scale = 0.08
  78. unitDesc.scn_name = "LBOT"
  79.